<?php
namespace app\admin\model;

use think\Model;

class NewProject extends Model
{
    /**
     *项目信息审核操作
     * @param $id 项目ID
     * @param $systerm_check 审核状态
     * @param $systerm_msg 审核意见
     * @author hey_heyang(635870453@qq.com)
     * @return 返回结果，status结果(1:成功; 0:失败),msg存放错误信息
     */
    public function confirmDetailProject($id,$systerm_check,$systerm_msg){
        $result['status'] = 1;
        $result['msg'] = '操作成功';
        $project_info = $this->where(array('id'=>$id))->find()->toArray();
        if($project_info){
            if($systerm_check==1){  //风控审核通过
                $this->where(array('id'=>$id))->update(array('status'=>2,'systerm_msg'=>$systerm_msg,'systerm_check_time'=>time()));
                companyTobeNotice($project_info['company_id'], '项目信息审核成功', '您申请的项目: '.$project_info['project_name'].' 已审核成功');
            }elseif($systerm_check==2){ // 风控审核不通过
                $this->where(array('id'=>$id))->update(array('status'=>3,'systerm_msg'=>$systerm_msg,'systerm_check_time'=>time()));
                companyTobeNotice($project_info['company_id'], '项目信息审核失败', $systerm_msg);
                $result['msg'] = '平台已拒绝';
            }
        }else{
            $result['status']=0;
            $result['msg'] = '未查询到项目信息';
        }
        return $result;

    }
}